package com.sixth.controller;

import com.sixth.entity.Role;
import com.sixth.service.RoleService;
import com.sixth.service.UserService;
import com.sixth.util.CommonResult;
import com.sixth.util.TableLayUi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: carrent
 * @description:
 * @author: 高振杨
 * @create: 2022-01-12 21:07
 **/
@RestController
@RequestMapping("role")
public class RoleController {

    @Autowired
    private RoleService roleService;

    @RequestMapping("AllRole")
    public TableLayUi AllRole(int page, int limit){
        TableLayUi role = roleService.AllRole(page,limit);
        return role;
    }
    @RequestMapping("/addOrUpdate")
    public CommonResult addOrUpdate(Role role){
        return  roleService.addOrUpdate(role);
    }

    @RequestMapping("/findAll")
    public TableLayUi role(int page, int limit){
        return roleService.findRoleByPage(page,limit);
    }

    @RequestMapping("/delById")
    public CommonResult delById(Integer roleid) {
        return roleService.delById(roleid);
    }
}
